home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 46
/
Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso
/
-serious-
/
sound
/
gui4mod2smp
/
gui4mod2smp.e
< prev
next >
Wrap
Text File
|
1999-09-06
|
8KB
|
319 lines
/***TAB SIZE=4***************************************************©bLA*****
**************************************************************************
little gui for mod2smp ...
*************************************************************************
*************************************************************************/
MODULE 'tools/easygui','afc/tooltype',
'reqtools', 'libraries/reqtools',
'workbench/startup', 'workbench/workbench'
ENUM NONE,ERR_RLIB
DEF tmod[256]:STRING,pmod,
tsmp[256]:STRING,psmp,
path[256]:STRING,
patt=0, start=0, stop=63, volum=100,
cnot,not=9,note[4]:STRING,
coct,oct=2,
crsp,rsmp=2,
ntsc=0, vbo=0, sus=0,
dcia=1,ccia,scia=125,
dvbl=1,cvbl,svbl=6
DEF slstar,slstop,slvbl,slcia,
filereq:PTR TO rtfilerequester,
t[256]:STRING,ttr=FALSE
PROC main() HANDLE
init()
easyguiA('Gui4Mod2Smp',
[ROWS,
[COLS,
[BUTTON, {getMod}, 'mod:'],
pmod:=[TEXT,tmod,NIL,TRUE,1]
],
[COLS,
[BUTTON, {getSmp}, 'smp:'],
psmp:=[TEXT,tsmp,NIL,TRUE,1]
],
[BEVEL,[ROWS,
[SLIDE,{getPat},' Pattern: ',FALSE,0,127,patt ,3,'%3ld'],
slstar:=[SLIDE,{getSta},' Start pos: ',FALSE,0,63 ,start,3,'%3ld'],
slstop:=[SLIDE,{getSto},' Stop pos: ',FALSE,0,63 ,stop ,3,'%3ld'],
[SLIDE,{getVol},' Volume: ',FALSE,0,100,volum ,3,'%3ld']
]],
[COLS,
[CYCLE,{getNot},' Note:',cnot,not,0,0],
[CYCLE,{getOct},' Ocatve:',coct,oct,0,0]
],
[BEVEL,[COLS,
[CHECK,{check1},' ntsc:',ntsc,TRUE,0],
[CHECK,{check2},' vblank only:',vbo,TRUE,0],
[CHECK,{check3},' sustain:',sus,TRUE,0]
]],
[BEVEL,[ROWS,
[COLS,
[CHECK,{checkVbl},'VBlank speed:',cvbl,FALSE,0,0],
slvbl:=[SLIDE,{getVbl},' ',FALSE,1,27,svbl,3,'%3ld',0,0,dvbl]
],
[COLS,
[CHECK,{checkCia},'CIA speed: ',ccia,FALSE,0,0],
slcia:=[SLIDE,{getCia},' ',FALSE,28,255,scia,3,'%3ld',0,0,dcia]
]
]],
[CYCLE,{getRspl},'Resample:',crsp,rsmp,0],
[BAR],
[SBUTTON,{go},'gO']
] )
EXCEPT DO
SELECT exception
CASE NONE
CASE ERR_RLIB; WriteF('Needs Reqtool.library V38+\n')
ENDSELECT
IF reqtoolsbase THEN CloseLibrary(reqtoolsbase)
CleanUp(0)
ENDPROC
/****************************************************************©bLA*****
*************************************************************************/
PROC init()
IF (reqtoolsbase:=OpenLibrary('reqtools.library', 38))=NIL THEN Raise(ERR_RLIB)
open_Icon()
cnot := ['C','C#','D','D#','E','F','F#','G','G#','A','A#','B',NIL]
coct := ['1','2','3',NIL]
crsp := ['0','1','No',NIL]
IF ttr=FALSE
StrCopy(path,'c:mod2smp')
StrCopy(tmod,'sys:')
StrCopy(tsmp,'t:')
ENDIF
StrCopy(note,'A')
ENDPROC
/****************************************************************©bLA*****
*************************************************************************/
PROC open_Icon() HANDLE
DEF ttype:PTR TO tooltype,s
NEW ttype.tooltype(TRUE)
s:=ttype.get('PATH')
IF s THEN StrCopy(path,s)
s:=ttype.get('MOD')
IF s THEN StrCopy(tmod,s)
s:=ttype.get('SMP')
IF s THEN StrCopy(tsmp,s)
s:=ttype.get('PATTERN')
IF s THEN patt:=Val(s)
s:=ttype.get('START')
IF s THEN start:=Val(s)
s:=ttype.get('STOP')
IF s THEN stop:=Val(s)
s:=ttype.get('VOLUME')
IF s THEN volum:=Val(s)
ttr:=TRUE
EXCEPT DO
END ttype
ENDPROC
/****************************************************************©bLA*****
*************************************************************************/
PROC getMod(gh)
DEF filename[110]:STRING,result
filereq:=RtAllocRequestA(RT_FILEREQ,NIL);
IF filereq
filename[0]:=0;
RtChangeReqAttrA(filereq,[RTFI_DIR,tmod,RTFI_MATCHPAT,'(#?.mod|mod.#?)',NIL])
result:=RtFileRequestA(filereq, filename, 'Pick a module',
[RTFI_DIR,RT_REQPOS,REQPOS_CENTERSCR,NIL]);
IF result<>0
StrCopy(tmod,filereq.dir)
RightStr(t,tmod,1)
IF StrCmp(t,':',1)=FALSE THEN StrAdd(tmod,'/')
StrAdd(tmod,filename)
settext(gh,pmod,tmod)
ENDIF
RtFreeRequest(filereq);
ELSE
RtEZRequestA('OUT MEM','OH BOY', NIL, NIL, NIL);
ENDIF
ENDPROC
/****************************************************************©bLA*****
*************************************************************************/
PROC getSmp(gh)
DEF filename[110]:STRING,result
filereq:=RtAllocRequestA(RT_FILEREQ,NIL);
IF filereq
filename[0]:=0;
RtChangeReqAttrA(filereq,[RTFI_DIR,tsmp,NIL])
result:=RtFileRequestA(filereq, filename, 'Pick a Sample',
[RTFI_DIR,RT_REQPOS,REQPOS_CENTERSCR,NIL]);
IF result<>0
StrCopy(tsmp,filereq.dir)
RightStr(t,tsmp,1)
IF StrCmp(t,':',1)=FALSE THEN StrAdd(tsmp,'/')
StrAdd(tsmp,filename)
settext(gh,psmp,tsmp)
ENDIF
RtFreeRequest(filereq);
ELSE
RtEZRequestA('OUT MEM','OH BOY', NIL, NIL, NIL);
ENDIF
ENDPROC
/****************************************************************©bLA*****
*************************************************************************/
PROC getPat(val) IS patt:=val
/****************************************************************©bLA*****
*************************************************************************/
PROC getSta(gh,val)
start:=val
IF start>stop THEN start:=stop-1
setslide(gh,slstar,start)
ENDPROC
/****************************************************************©bLA*****
*************************************************************************/
PROC getSto(gh,val)
stop:=val
IF stop<start THEN stop:=start+1
setslide(gh,slstop,stop)
ENDPROC
/****************************************************************©bLA*****
*************************************************************************/
PROC getVol(val) IS volum:=val
/****************************************************************©bLA*****
*************************************************************************/
PROC getNot(val)
cnot:=val
SELECT val
CASE 0 ; StrCopy(note,'C')
CASE 1 ; StrCopy(note,'C#')
CASE 2 ; StrCopy(note,'D')
CASE 3 ; StrCopy(note,'D#')
CASE 4 ; StrCopy(note,'E')
CASE 5 ; StrCopy(note,'F')
CASE 6 ; StrCopy(note,'F#')
CASE 7 ; StrCopy(note,'G')
CASE 8 ; StrCopy(note,'G#')
CASE 9 ; StrCopy(note,'A')
CASE 10 ; StrCopy(note,'A#')
CASE 11 ; StrCopy(note,'B')
ENDSELECT
ENDPROC
PROC getOct(val) IS coct:=val
/****************************************************************©bLA*****
*************************************************************************/
PROC check1(val) IS IF val THEN ntsc:=TRUE ELSE ntsc:=FALSE
PROC check2(val) IS IF val THEN vbo:=TRUE ELSE vbo:=FALSE
PROC check3(val) IS IF val THEN sus:=TRUE ELSE sus:=FALSE
/****************************************************************©bLA*****
*************************************************************************/
PROC getVbl(val) IS svbl:=val
PROC getCia(val) IS scia:=val
PROC checkVbl(gh,val)
dvbl:=dvbl=FALSE
setdisabled(gh,slvbl,dvbl)
ENDPROC
PROC checkCia(gh,val)
dcia:=dcia=FALSE
setdisabled(gh,slcia,dcia)
ENDPROC
/****************************************************************©bLA*****
*************************************************************************/
PROC getRspl(val) IS rsmp:=val
/****************************************************************©bLA*****
*************************************************************************/
PROC go()
DEF cmd[1024]:STRING, d[8]:STRING
StrCopy(cmd,path) ; StrAdd(cmd,' "')
StrAdd(cmd,tmod) ; StrAdd(cmd,'" "')
StrAdd(cmd,tsmp) ; StrAdd(cmd,'" ')
StringF(d,'\d',patt) ; StrAdd(cmd,d) ; StrAdd(cmd,' ')
StringF(d,'\d',start) ; StrAdd(cmd,d) ; StrAdd(cmd,' ')
StringF(d,'\d',stop) ; StrAdd(cmd,d) ; StrAdd(cmd,' ')
StringF(d,'\d',volum) ; StrAdd(cmd,d) ; StrAdd(cmd,' ')
StrAdd(cmd,note)
StringF(d,'\d',oct+1) ; StrAdd(cmd,d) ; StrAdd(cmd,' ')
IF ntsc THEN StrAdd(cmd,' -n')
IF vbo THEN StrAdd(cmd,' -v')
IF sus THEN StrAdd(cmd,' -s')
IF dvbl=0
StrAdd(cmd,' -f')
StringF(d,'\d',svbl)
StrAdd(cmd,d)
ENDIF
IF dcia=0
StrAdd(cmd,' -c')
StringF(d,'\d',scia)
StrAdd(cmd,d)
ENDIF
IF rsmp<>2
StrAdd(cmd,' -r')
StringF(d,'\d',rsmp)
StrAdd(cmd,d)
ENDIF
exec(cmd)
DisplayBeep(NIL)
ENDPROC
PROC exec(arg) IS Execute(arg,0,stdout)
CHAR '$VER:Gui2Mod2Smp by bLa$Ter_oNe! 0.1 (26/08/1999)',0